package com.archerdu.demo.mail;

import javax.mail.MessagingException;
import javax.mail.internet.AddressException;

import com.archerdu.base.mail.MailSender;
import com.archerdu.base.mail.model.ContentInfo;
import com.archerdu.base.mail.model.ReceiveInfo;
import com.archerdu.base.mail.model.ServerInfo;

public class BaseMailSender {
    public static void main(String[] args) {
        ServerInfo si = new ServerInfo();
        si.setServerHost("smtp.qq.com");
        si.setServerPort("25");
        si.setValidate(true);
        si.setUserName("archerdu@qq.com");
        si.setPassword("*****");
        si.setFromAddress("archerdu@qq.com");
        
        ContentInfo ci = new ContentInfo();
        ci.setSubject("baseSender");
        ci.setHtml(true);
        ci.setContent("<a href=\"http://www.baidu.com\">baidu</a>");
        
        ReceiveInfo ri = new ReceiveInfo();
        ri.setToAddress("*****");
        
        try {
            MailSender.send(si, ci, ri);
        } catch (AddressException e) {
            e.printStackTrace();
        } catch (MessagingException e) {
            e.printStackTrace();
        }
    }

}
